package cz.muni.fi.pa165.travelagency.web.frontend;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
public class FrontendActionBean implements ActionBean {
 
    final static Logger log = LoggerFactory.getLogger(cz.muni.fi.pa165.travelagency.web.AdminActionBean.class);
 
    private ActionBeanContext context;

    public FrontendActionBean() { 
        if(SecurityUtils.getSubject().isAuthenticated() == false) {
            SecurityUtils.getSubject().login(new UsernamePasswordToken("user", "user", true));
        }
    }

    @Override
    public void setContext(ActionBeanContext context) {
        this.context = context;
    }
 
    @Override
    public ActionBeanContext getContext() {
        return context;
    }
}